package com.fwtai.api;

import com.fwtai.bean.PageFormData;
import com.fwtai.datasource.DaoHandle;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 通知|公告
 * @作者 田应平
 * @版本 v1.0
 * @创建时间 2021年7月20日 10:42:45
 * @QQ号码 444141300
 * @Email service@yinlz.com
 * @官网 <url>http://www.fwtai.com</url>
*/
@Repository
public class ApiMessageDao{

    @Resource
    private DaoHandle dao;

    public List<Map<String,Object>> getListType1(final PageFormData formData){
        return dao.queryForListMap("api_inform.ListType1Data",formData);
    }

    public List<Map<String,Object>> getListType2(final PageFormData formData){
        return dao.queryForListMap("api_inform.ListType2Data",formData);
    }

    public List<Map<String,Object>> getListType3(final PageFormData formData){
        return dao.queryForListMap("api_inform.ListType3Data",formData);
    }

    public Integer getUnreadType1(final String loginId){
        return dao.queryForInteger("api_inform.getUnreadType1",loginId);
    }

    public Integer getUnreadType2(final String loginId){
        return dao.queryForInteger("api_inform.getUnreadType2",loginId);
    }

    public Integer getUnreadType3(final String loginId){
        return dao.queryForInteger("api_inform.getUnreadType3",loginId);
    }

    public HashMap<String,Object> getMessageType1(final String kid,final Integer split){
        switch (split){
            case 1:
                return dao.queryForHashMap("api_inform.partnerInfo",kid);
            case 3:
                return dao.queryForHashMap("api_inform.getCaseInfoById",kid);
            case 4:
                return dao.queryForHashMap("api_inform.getCaseAccept",kid);//案件预约状态
            default:
                break;
        }
        return null;
    }

    public HashMap<String,Object> getMessageType2(final String kid,final Integer split){
        switch (split){
            case 1:
                return dao.queryForHashMap("api_inform.partnerInfo",kid);
            case 2:
                return dao.queryForHashMap("api_inform.getLawyerInfoById",kid);
            default:
                break;
        }
        return null;
    }

    public HashMap<String,Object> getMessageType3(final String kid,final Integer split){
        switch (split){
            case 1:
                return dao.queryForHashMap("api_inform.partnerInfo",kid);
            case 2:
                return dao.queryForHashMap("api_inform.getEnterpriseInfoById",kid);
            default:
                break;
        }
        return null;
    }
}